home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Controls
/
Visual Basic Controls.iso
/
vbcontrol
/
keyservh
/
mainform.frm
< prev
next >
Wrap
Text File
|
1999-08-20
|
5KB
|
181 lines
VERSION 5.00
Begin VB.Form MainForm
BorderStyle = 1 'Fixed Single
Caption = "Service Test Harness"
ClientHeight = 1545
ClientLeft = 45
ClientTop = 330
ClientWidth = 4395
Icon = "MainForm.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 1545
ScaleWidth = 4395
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton Shutdown
Caption = "Shutdown"
Enabled = 0 'False
Height = 375
Left = 3360
TabIndex = 6
Top = 1080
Width = 975
End
Begin VB.CommandButton Control
Caption = "Control"
Enabled = 0 'False
Height = 375
Left = 2280
TabIndex = 5
Top = 1080
Width = 975
End
Begin VB.CommandButton PauseContinue
Caption = "Pause"
Enabled = 0 'False
Height = 375
Left = 1200
TabIndex = 4
Top = 1080
Width = 975
End
Begin VB.CommandButton StartStop
Caption = "Start"
Enabled = 0 'False
Height = 375
Left = 120
TabIndex = 3
Top = 1080
Width = 975
End
Begin VB.TextBox ProgId
Height = 285
Left = 1440
TabIndex = 2
Top = 600
Width = 2895
End
Begin VB.Label Label2
Caption = "Specify the Prog ID of the ActiveX class you want to test."
Height = 375
Left = 120
TabIndex = 0
Top = 120
Width = 4095
End
Begin VB.Label Label1
Caption = "Service Prog ID:"
Height = 255
Left = 120
TabIndex = 1
Top = 600
Width = 1215
End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************************************
' Copyright (c) Key Technology Pty Ltd 1999, All Rights Reserved.
' Web site: http://www.keytech.com.au Email: info@keytech.com.au
'****************************************************************************************************
Option Explicit
'
' The service test harness may be used to test ActiveX controls that are to be
' hosted by the Service Host executable.
'
Private ServiceObject As IService
Private Sub ProgId_Change()
If StartStop.Caption = "Start" Then
StartStop.Enabled = (Len(ProgId) <> 0)
End If
End Sub
Private Sub StartStop_Click()
On Error Resume Next
If StartStop.Caption = "Start" Then
Set ServiceObject = CreateObject(ProgId)
If Err Then
MsgBox "Failed to create service object. " & vbNewLine & _
"Check that the ActiveX DLL is properly installed."
Exit Sub
End If
ServiceObject.OnStart
If Err Then
MsgBox "OnStart failed - " & Err.Description
End If
PauseContinue.Enabled = ServiceObject.Pausable
Control.Enabled = True
Shutdown.Enabled = True
StartStop.Caption = "Stop"
Else
ServiceObject.OnStop
If Err Then
MsgBox "OnStop failed - " & Err.Description
End If
PauseContinue.Enabled = False
Control.Enabled = False
Shutdown.Enabled = False
StartStop.Caption = "Start"
End If
End Sub
Private Sub PauseContinue_Click()
On Error Resume Next
If PauseContinue.Caption = "Pause" Then
ServiceObject.OnPause
If Err Then
MsgBox "OnPause failed - " & Err.Description
End If
PauseContinue.Caption = "Continue"
Else
ServiceObject.OnContinue
If Err Then
MsgBox "OnContinue failed - " & Err.Description
End If
PauseContinue.Caption = "Pause"
End If
End Sub
Private Sub Control_Click()
On Error Resume Next
' OpCode must be within the range 128 to 255 inclusive
ServiceObject.OnControl 128
If Err Then
MsgBox "OnShutdown failed - " & Err.Description
End If
End Sub
Private Sub Shutdown_Click()
On Error Resume Next
ServiceObject.OnShutdown
If Err Then
MsgBox "OnShutdown failed - " & Err.Description
End If
End Sub